Skip to content

Conversation

@whwangyf
Copy link

No description provided.

insertOutMessage(ui->contentBox->toPlainText());
emit newMessage(sender,receiver,QDateTime::currentDateTime(),ui->contentBox->toPlainText());
QString text=ui->contentBox->toPlainText();
if(text!="")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里以及类似的用法都改成调用 isEmpty 判断


void ChatDialog::on_photoBtn_clicked()
{
strFilePath = QFileDialog::getOpenFileName(this, QString::fromLocal8Bit("选择上传图片"), "./", tr("Image files(*.bmp *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm *.jpeg);;All files (*.*)"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果能正确运用 QString 会更好。

src/chatdialog.h Outdated
QTextCursor save;
int savepos;

QString strFilePath;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这三项不应该成为 ChatDialog 的类成员

src/chatdialog.h Outdated
#include <QTextFrame>
#include <QDateTime>
#include <QXmppMessage.h>
#include <QFileDialog>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

减少头文件中不必要的 #include 语句

@chirsz-ever
Copy link
Collaborator

另,建议不要在 master 分支上直接 commit,而是新建分支进行修改,以使 fork 仓库的 master 与源仓库的 master 保持一致。

@chirsz-ever
Copy link
Collaborator

当前实现中发送图片是发送 <body>URL=imgurl</body> 的形式,建议改成 img 标签,形式是 <body><img src="imgurl" /></body>,这样可以兼容其它使用富文本渲染的客户端。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants